<?php
$m_start=memory_get_usage(true);

function getmicrotime($from=false){
    list($usec, $sec) = explode(" ", microtime());
    $tm = ((float)$usec + (float)$sec);
    if ($from) return $tm-$from;
    else return $tm;
}

$t_start=getmicrotime();

$t=array();
for( $i=0;$i<999999; $i++ ){
  $t[$i]=$i;
}

$t_proc=getmicrotime($t_start);

$m_end=memory_get_usage(true);
echo 'start:'.($m_start/1024/1024).'<br />end:'.($m_end/1024/1024).'<br />';
echo 'diff:'.(($m_end-$m_start)/1024/1024).'<br />';
echo 'peak:',(memory_get_peak_usage(true)/1024/1024);
echo '<br />time:'.$t_proc;
?>
